nmsmoddingfandomcom-20200214-history
Adding new buildable objects
Introduction This article serves as a tutorial to adding new buildable objects. This means that we will create a custom object and make it appear in the build menus. It is possible to add custom models, but for the sake of this tutorial we will make reuse a table object that already exists in-game resources but not normally available to be built. There are three steps to follow in order to make an object available to build from the build menus: #Adding the buildable object entry in BASEBUILDINGTABLE.MBIN; #Adding the buildable object entry in NMS_REALITY_GCPRODUCTTABLE.MBIN; #Making the buildable object available to acquire in game. The use of NMS Modding Station is recommended, and shall be used in this article for demonstration when relevant. If you haven't set it up already, make sure you do so as explained in Accessing Game Assets. Locating BASEBUILDINGTABLE.MBIN and NMS_REALITY_GCPRODUCTTABLE.MBIN First of all, create a new project in NMS Modding Station. Call it however you prefer (i.e. TestTable). From the Unpacked Game Files tab, navigate to METADATA\REALITY\TABLES, select BASEBUILDINGTABLE.MBIN and NMS_REALITY_GCPRODUCTTABLE.MBIN, right click on them and select Copy to Project Files. This will make sure that the files are now copied in your mod folder (please note that the entire folder structure will be carried over by NMS Modding Station). If you are not using NMS Modding Station, make sure you manually recreate the folder structure. Now that the files are copied to your mod folder, you need to decompile the MBIN files as outlined in Accessing Game Assets. 1. Adding entry in BASEBUILDINGTABLE.MBIN We are now ready to edit the decompiled files. We will start from BASEBUILDINGTABLE.MBIN (which will now be decompiled as BASEBUILDINGTABLE.exml). The objective is to duplicate the structure from an existing object already present in the exml file, and edit the parameters to create a custom one. Creating a building entry Open BASEBUILDINGTABLE.exml with the text editor of your choice (Notepad++ is recommended). Navigate to the “'Objects'” nested entry (which should be around line 20), select the entire content of the first “'GcBaseBuildingEntry.xml'” entry, and then paste it in order to create a duplicate. This duplicate will act as the template for our new entry we will use for our custom buildable table. The entry should look something like this: Understanding and editing “GcBaseBuildingEntry.xml” entries The xml file has many properties, and we will now describe the most important, or frequently used ones: *'ID': the ID of the object. Each object should have a unique object ID, the length of this value must not exceed 16 characters, for demonstration, it shall be modified to “'TESTTABLE'”; * Model: **'Filename': the file location of the object to be added. For this particular case, the location of the object is located at MODELS/PLANETS/BIOMES/COMMON/BUILDINGS/PARTS/BUILDABLEPARTS/DECORATION/TABLE1.SCENE.MBIN, and shall be changed to such; *'BuildableOnBase, BuildableOnFreighter, BuildableOnPlanet': boolean properties deciding if the object can be built within planetary player base limits, inside the player freighter base, and outside planetary player base limits (a.k.a in the fields); *'GlobalLimit, SystemLimit, PlanetLimit, RegionLimit': properties restricting the number of this object which can be built in the entire galaxy, one system, one planet, and one “region” (a general area covering a certain amount of distance). A value of 0 refers to an unlimited amount; *'PlanetBaseLimit, FreighterBaseLimit': properties setting the limit number of this objects which can be built in the planetary player base and in the player freighter. A value of 0 refers to an unlimited amount; *'CheckCollision': boolean value deciding if the game will also check whether the object can be placed base on scene collision data, rather than just from the mesh itself; *'Group': property deciding which group the object is put in inside the build menus. For demonstration purposes, the object shall be put in a custom group named ADDIT. We will setup this group in the next step of the tutorial, so keep this name in mind; After editing your custom entry, it should look something like this: Adding a custom group entry So far we have worked with the building entry of the table. Now we will create a custom group that the entry is part of (you should remember that we already assigned a group to it in the previous step!). In the same exml file, navigate to the “'Groups'” nested entry. We will now do the same thing as we did before, and duplicate an existing entry to have a skeleton already in place. Copy a “'GcBaseBuildingGroup.xml'” entry and paste it. The group entry should look something like this: These are the two most important properties to keep in mind: *'ID': the ID of the group. This property corresponds to the “'Group'” property the we declared in the building entry; *'Name': the name of the group. It can correspond to the language files for translations in different languages, or named in plain text and appearing in the build menu in the language written. We will edit these two properties to match the building entry. the modified entry should look like this: This concludes the editing phase for BASEBUILDINGTABLE.exml. 2. Adding entry in NMS_REALITY_GCPRODUCTTABLE.MBIN We will now go and edit NMS_REALITY_GCPRODUCTTABLE.MBIN in a very similar way. Our goal is to make sure that the buildable object we created in BASEBUILDINGTABLE.exml is correctly referenced in this file. Once again we will duplicate the structure from an existing object already present in the exml file, and edit the parameters to create a custom one. Creating a building entry Select the entire content of a “'GcProductData.xml'” entry, and then paste it in order to create a duplicate. This duplicate will act as the template for our new entry we will use for our custom buildable table. It is suggested to copy an entry of an existing buildable object entry, instead of a crafted product, when creating a new buildable object entry for ease of modification. The entry should look something like this: Understanding “GcProductData.xml” entries The xml file has many properties, and we will now describe the most important, or frequently used ones: *'ID': ID of the object. It corresponds to the ID entry of the respective object we created in BASEBUILDINGTABLE.MBIN. In our case we will use “'TESTTABLE'”, following what we did in the previous paragraph; *'Name, NameLower, Description': Name of the object in all uppercase, normal form, and its description. It can correspond to the language files for translations in different languages, or named in plain text. These are the strings that appears in the build menu; *'Icon': location of the icon image file. The file must be in DDS format, and must contain an ALL UPPERCASE DDS file extension; *'SubstanceCategory': **'SubstanceCategory': the substance category the entry belongs to. As a buildable object, this property should have the value of “'BuildingPart'”; *'Category': **'ProductCategory': the product category the entry belongs to. As a buildable object, this property should also have the value of “'BuildingPart'”; *'Requirements': the cost of building the object. Each ingredient should have its separate entry, and a maximum of three types of ingredient can be inputted. Each of these ingredients will have the following properties: **'ID': refers to the ID of the type of ingredient. See this table for a list of substances; **'InventoryType': refers to the type of substance. It is either “'Substance'”, generally an element, or “'Product'”, generally an item; **'Amount': refers to the number of ingredient required to build the object. The amount must be larger than 0. Our modified table entry should look something like this: This concludes the editing phase for NMS_REALITY_GCPRODUCTTABLE.exml. 3. Making the object available to acquire in game Now that our exml files have been edited correctly, we need to make sure we can actually see our test table in-game. There are multiple ways in which we can include the blueprint of our custom object, and you can use whichever works best for you: *'Default Save Data': adding the blueprint into DEFAULTSAVEDATA.MBIN and DEFAULTSAVEDATACREATIVE.MBIN. These files are the default save data that is loaded when starting the game. The blueprint will be immediately given to the player; *'Vendor's List': adding an entry into PURCHASEABLEBUILDINGBLUEPRINTS.MBIN. This will add the blueprint into the vendor’s list in the planetary player base; *'Rewards': adding the blueprint into REWARDTABLE.MBIN. This will add the blueprint as a reward from interacting with various objects in game, such as dead sentinels, alien conversations, and custom objects. Adding entry into Default Save Data As we did at the beginning of the tutorial, open NMS Modding Station, locate DEFAULTSAVEDATA.MBIN and DEFAULTSAVEDATACREATIVE.MBIN in METADATA\GAMESTATE and copy both files to your project location. After doing this, decompile them and open either one of the files. Search for the nested property “'KnownProducts'”, copy and paste an “'NMSString0x10.xml'” entry to create a duplicate. The entry should look something like this: Edit the “'Value'” value, and copy the entry to the other default save file under the KnownProducts property. In other words, make sure that both files have the same entry. Adding entry into Vendor's List Navigate to METADATA\REALITY\TABLES to find PURCHASEABLEBUILDINGBLUEPRINTS.MBIN. Decompile it and open it with your text editor. Copy and paste an “'NMSString0x10.xml'” entry. The entry should look something like this: Edit the “'Value'” value to whatever you prefer. NOTE: No Man's Sky hides every 6th entry of this table. If your added entry is hidden in game, create a dummy entry in NMS_REALITY_GCPRODUCTTABLE.MBIN, and reference it in the slot in PURCHASEABLEBUILDINGBLUEPRINTS.MBIN which would be hidden by the game. Adding entry into Rewards (Due to the sophistication and many ways of adding entries into REWARDTABLE.MBIN, new entry should be created.) Finally, Compile Your Mod! Now you have completed all the necessary steps to have your buildable table ready. We now have to compile the mod. For information on how to do it, check here. Category:Tutorial